# -*- Makefile -*- for Dungeon Crawl (OS X)

#APPNAME = crawl
GAME = crawl

# this file contains a list of the libraries.
# it will make a variable called OBJECTS that contains all the libraries
include makefile.obj

OBJECTS += liblinux.o

CXX = g++
DELETE = rm -f
COPY = cp 
OS_TYPE = BSD

CFLAGS = -D$(OS_TYPE) -DOSX $(EXTRA_FLAGS) -Wall -Werror \
            -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
            -Wmissing-declarations

LDFLAGS = -L/sw/lib -L/usr/lib
MCHMOD = 711 
# INSTALLDIR = /usr/games
INSTALLDIR = /tmp/CRAWLTEST/testdev
LIB = -lncurses -lstdc++

# Include for Fink's version of curses
INCLUDES = -I/sw/include

all: $(GAME)

install: $(GAME) 
	$(COPY) $(GAME) ${INSTALLDIR}
	${MCHMOD} ${INSTALLDIR}/$(GAME)

clean:          
	$(DELETE) *.o

distclean:                
	$(DELETE) *.o
	$(DELETE) bones.*
	$(DELETE) morgue.txt
	$(DELETE) scores
	$(DELETE) $(GAME)
	$(DELETE) *.sav
	$(DELETE) core
	$(DELETE) *.0*
	$(DELETE) *.lab


$(GAME): $(OBJECTS)
	${CXX} ${LDFLAGS} $(INCLUDES) $(CFLAGS) $(OBJECTS) -o $(GAME) $(LIB)
	strip $(GAME)
	chmod ${MCHMOD} $(GAME)

debug: $(OBJECTS)
	${CXX} ${LDFLAGS} $(INCLUDES) $(CFLAGS) $(OBJECTS) -o $(GAME) $(LIB)

profile:        $(OBJECTS)
	${CXX} -g -p ${LDFLAGS} $(INCLUDES) $(CFLAGS) $(OBJECTS) -o $(GAME) $(LIB)

.cc.o:  
	${CXX} ${CFLAGS} $(INCLUDES) -c $< ${INCLUDE}

.h.cc:  
	touch $@

